package top.wineye.spring.bean.factory;

import org.springframework.beans.factory.DisposableBean;
import top.wineye.model.User;

import javax.annotation.PreDestroy;

public class AnotherUserFactory implements DisposableBean {

    @PreDestroy
    public void destroyByAnnotation() {
        System.out.println("destroy hook by @PreDestroy run ... ");
    }

    public void destroyMethod() {
        System.out.println("destroy hook by destroy-method ... ");
    }

    public User getInstance() {
        return User.getInstance();
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy defined by interface DisposableBean#destroy");
    }
}
